{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1.导入必要的包 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "# -*- coding:utf-8 -*-\n",
    "import sys\n",
    "#矩阵操作\n",
    "import numpy as np\n",
    "#处理csv文件 SQL数据处理\n",
    "import pandas as pd\n",
    "\n",
    "#画直方图用，对数据结果进行可视化\n",
    "import matplotlib.pyplot as plt\n",
    "#对matplotlib进行一次封装，画图更容易，使用更方便\n",
    "import seaborn as sns\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.共享单车骑行量预测\n",
    "读入特征工程后的文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>instant</th>\n",
       "      <th>dteday</th>\n",
       "      <th>season</th>\n",
       "      <th>yr</th>\n",
       "      <th>mnth</th>\n",
       "      <th>holiday</th>\n",
       "      <th>weekday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>weathersit</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>casual</th>\n",
       "      <th>registered</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2011-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.344167</td>\n",
       "      <td>0.363625</td>\n",
       "      <td>0.805833</td>\n",
       "      <td>0.160446</td>\n",
       "      <td>331</td>\n",
       "      <td>654</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2011-01-02</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.363478</td>\n",
       "      <td>0.353739</td>\n",
       "      <td>0.696087</td>\n",
       "      <td>0.248539</td>\n",
       "      <td>131</td>\n",
       "      <td>670</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>2011-01-03</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.196364</td>\n",
       "      <td>0.189405</td>\n",
       "      <td>0.437273</td>\n",
       "      <td>0.248309</td>\n",
       "      <td>120</td>\n",
       "      <td>1229</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>2011-01-04</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.200000</td>\n",
       "      <td>0.212122</td>\n",
       "      <td>0.590435</td>\n",
       "      <td>0.160296</td>\n",
       "      <td>108</td>\n",
       "      <td>1454</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>2011-01-05</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.226957</td>\n",
       "      <td>0.229270</td>\n",
       "      <td>0.436957</td>\n",
       "      <td>0.186900</td>\n",
       "      <td>82</td>\n",
       "      <td>1518</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   instant      dteday  season  yr  mnth  holiday  weekday  workingday  \\\n",
       "0        1  2011-01-01       1   0     1        0        6           0   \n",
       "1        2  2011-01-02       1   0     1        0        0           0   \n",
       "2        3  2011-01-03       1   0     1        0        1           1   \n",
       "3        4  2011-01-04       1   0     1        0        2           1   \n",
       "4        5  2011-01-05       1   0     1        0        3           1   \n",
       "\n",
       "   weathersit      temp     atemp       hum  windspeed  casual  registered  \\\n",
       "0           2  0.344167  0.363625  0.805833   0.160446     331         654   \n",
       "1           2  0.363478  0.353739  0.696087   0.248539     131         670   \n",
       "2           1  0.196364  0.189405  0.437273   0.248309     120        1229   \n",
       "3           1  0.200000  0.212122  0.590435   0.160296     108        1454   \n",
       "4           1  0.226957  0.229270  0.436957   0.186900      82        1518   \n",
       "\n",
       "    cnt  \n",
       "0   985  \n",
       "1   801  \n",
       "2  1349  \n",
       "3  1562  \n",
       "4  1600  "
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#读取数据\n",
    "df = pd.read_csv(\"day.csv\")\n",
    "#显示前五行，了解每列（特征）的情况\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 731 entries, 0 to 730\n",
      "Data columns (total 16 columns):\n",
      "instant       731 non-null int64\n",
      "dteday        731 non-null object\n",
      "season        731 non-null int64\n",
      "yr            731 non-null int64\n",
      "mnth          731 non-null int64\n",
      "holiday       731 non-null int64\n",
      "weekday       731 non-null int64\n",
      "workingday    731 non-null int64\n",
      "weathersit    731 non-null int64\n",
      "temp          731 non-null float64\n",
      "atemp         731 non-null float64\n",
      "hum           731 non-null float64\n",
      "windspeed     731 non-null float64\n",
      "casual        731 non-null int64\n",
      "registered    731 non-null int64\n",
      "cnt           731 non-null int64\n",
      "dtypes: float64(4), int64(11), object(1)\n",
      "memory usage: 91.5+ KB\n"
     ]
    }
   ],
   "source": [
    "#数据的总体信息\n",
    "#一共包含多少个样本点，一共多少列，列的名字，非空数值，数据类型\n",
    "#X 需要是一个数值，方便处理，对字符串的需要进行编码，才能送到数据模型中\n",
    "df.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 特征工程"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>mnth_6</th>\n",
       "      <th>...</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "      <th>weekday_0</th>\n",
       "      <th>weekday_1</th>\n",
       "      <th>weekday_2</th>\n",
       "      <th>weekday_3</th>\n",
       "      <th>weekday_4</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  mnth_4  \\\n",
       "0         1         0         0         0       1       0       0       0   \n",
       "1         1         0         0         0       1       0       0       0   \n",
       "2         1         0         0         0       1       0       0       0   \n",
       "3         1         0         0         0       1       0       0       0   \n",
       "4         1         0         0         0       1       0       0       0   \n",
       "\n",
       "   mnth_5  mnth_6  ...  weathersit_1  weathersit_2  weathersit_3  weekday_0  \\\n",
       "0       0       0  ...             0             1             0          0   \n",
       "1       0       0  ...             0             1             0          1   \n",
       "2       0       0  ...             1             0             0          0   \n",
       "3       0       0  ...             1             0             0          0   \n",
       "4       0       0  ...             1             0             0          0   \n",
       "\n",
       "   weekday_1  weekday_2  weekday_3  weekday_4  weekday_5  weekday_6  \n",
       "0          0          0          0          0          0          1  \n",
       "1          0          0          0          0          0          0  \n",
       "2          1          0          0          0          0          0  \n",
       "3          0          1          0          0          0          0  \n",
       "4          0          0          1          0          0          0  \n",
       "\n",
       "[5 rows x 26 columns]"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y = df['cnt']\n",
    "X = df.drop(['cnt', 'casual', 'registered', 'instant', 'dteday'], axis = 1)\n",
    "#对类别性特征进行独热编码\n",
    "categorical_features =['season', 'mnth', 'weathersit', 'weekday']\n",
    "for col in categorical_features:\n",
    "    X[col] = X[col].astype('object')\n",
    "\n",
    "X_cat = X[categorical_features]\n",
    "#独热编码\n",
    "X_cat = pd.get_dummies(X_cat)\n",
    "X_cat.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>season</th>\n",
       "      <th>yr</th>\n",
       "      <th>mnth</th>\n",
       "      <th>holiday</th>\n",
       "      <th>weekday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>weathersit</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.344167</td>\n",
       "      <td>0.363625</td>\n",
       "      <td>0.805833</td>\n",
       "      <td>0.160446</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.363478</td>\n",
       "      <td>0.353739</td>\n",
       "      <td>0.696087</td>\n",
       "      <td>0.248539</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.196364</td>\n",
       "      <td>0.189405</td>\n",
       "      <td>0.437273</td>\n",
       "      <td>0.248309</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.200000</td>\n",
       "      <td>0.212122</td>\n",
       "      <td>0.590435</td>\n",
       "      <td>0.160296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.226957</td>\n",
       "      <td>0.229270</td>\n",
       "      <td>0.436957</td>\n",
       "      <td>0.186900</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  season  yr mnth  holiday weekday  workingday weathersit      temp     atemp  \\\n",
       "0      1   0    1        0       6           0          2  0.344167  0.363625   \n",
       "1      1   0    1        0       0           0          2  0.363478  0.353739   \n",
       "2      1   0    1        0       1           1          1  0.196364  0.189405   \n",
       "3      1   0    1        0       2           1          1  0.200000  0.212122   \n",
       "4      1   0    1        0       3           1          1  0.226957  0.229270   \n",
       "\n",
       "        hum  windspeed  \n",
       "0  0.805833   0.160446  \n",
       "1  0.696087   0.248539  \n",
       "2  0.437273   0.248309  \n",
       "3  0.590435   0.160296  \n",
       "4  0.436957   0.186900  "
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [],
   "source": [
    "#去掉类别性特征\n",
    "X = X.drop(categorical_features, axis = 1)\n",
    "#获得特征名称，进行特征比较\n",
    "feat_names = X.columns\n",
    "#对数值型特征进行标准化处理，这里使用MinMaxScaler\n",
    "from sklearn.preprocessing import MinMaxScaler\n",
    "\n",
    "mms_X = MinMaxScaler()\n",
    "mms_y = MinMaxScaler()\n",
    "\n",
    "X = mms_X.fit_transform(X)\n",
    "#将y转换成二维数组\n",
    "y = mms_y.fit_transform(np.array(y).reshape(-1, 1))\n",
    "#将数值型转换为dataFrame格式\n",
    "X_num = pd.DataFrame(data = X, columns = feat_names, index = range(X.shape[0]))\n",
    "X = pd.concat([X_num, X_cat], axis = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.2,random_state=30)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "最小二乘回归的测试集RMSE： 0.14201760930271484\n",
      "最小二乘回归的训练集RMSE： 0.13708436316114087\n"
     ]
    }
   ],
   "source": [
    "#最小二乘\n",
    "lr = LinearRegression()\n",
    "lr.fit(X_train, y_train)\n",
    "y_test_pred_lr = lr.predict(X_test)\n",
    "y_train_pred_lr = lr.predict(X_train)\n",
    "\n",
    "print('最小二乘回归的测试集RMSE：', np.sqrt(mean_squared_error(y_test,y_test_pred_lr)))\n",
    "print('最小二乘回归的训练集RMSE：', np.sqrt(mean_squared_error(y_train,y_train_pred_lr)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "岭回归的测试集RMSE： 0.08672903079158813\n",
      "岭回归的训练集RMSE： 0.08757043471168033\n"
     ]
    }
   ],
   "source": [
    "#岭回归\n",
    "#\n",
    "alphas = [0.01,0.1,1,10,100]\n",
    "ridge = RidgeCV(alphas=alphas, store_cv_values=True)\n",
    "ridge.fit(X_train, y_train)\n",
    "y_test_pred_ridge = ridge.predict(X_test)\n",
    "y_train_pred_ridge = ridge.predict(X_train)\n",
    "\n",
    "print('岭回归的测试集RMSE：', np.sqrt(mean_squared_error(y_test,y_test_pred_ridge)))\n",
    "print('岭回归的训练集RMSE：', np.sqrt(mean_squared_error(y_train,y_train_pred_ridge)))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEGCAYAAABy53LJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF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GWFnkTmD0Js1/sikBrOS8qkqs8L8K/AlSaOS6w4fJ/Mwwn8j0+ioQVILmfahA14FZiTT44FdwI5k3KXD7KeBzNNxAb4MPH2IuiYAG5MjnmvItIMdMIvqeDqy1RkfcZgV5iEy1y9eInMU8PWI2CTpR8CFZB7Hvo5MM58dyTo/JRMkP4uIlyS9ALyWjPu3YfazC5gr6U/JnGr60iHq+lvgR5J+B3g0WX/Af0hqMCspPx3X7DBJGheZrm8TyRyFXJCEylFkHkV+QXJtpJBt9UTEuBLV9QtgfkRsL8X2zAb4iMPs8P2TpGOA0cCfR8QmgIh4V9I3yfR2XlvOgpLTad9yaFgafMRhZmZF8cVxMzMrioPDzMyK4uAwM7OiODjMzKwoDg4zMyvK/wdRcDAQB5iWoAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 1.0\n"
     ]
    }
   ],
   "source": [
    "#可视化\n",
    "mse_mean = np.mean(ridge.cv_values_,axis=0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1))\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "\n",
    "print ('alpha is:', ridge.alpha_)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "默认的超参数选择的是最优超参数1，接下来在1附近寻找有没有更好的超参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "岭回归的测试集RMSE： 0.08671694465373474\n",
      "岭回归的训练集RMSE： 0.08754040117875647\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEGCAYAAABy53LJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t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K4AxwK2S3gv0A+/KGb+dzKNfzMrKwWGWnv1knkGFpFnAl4FzI2KXpH/JLjuM3GcCHUi+9/PG393/TuYZYXPJnEHoyRl/VFKDWVn5VJXZ0PwH8DlJo5PrDh8k8zDCx8k0Ohol6QQy7UOzXgRmJ9MTgL1AdzLu0kH2M4rM03EBPg88dpi6JgJbkyOeq8m0g816F7XxdGQbZnzEYTY0D5C5fvEcmaOAr0TENkk/AC4i8zj2TWSa+XQn6/yETJD8PCKek/QMsDYZ9/gg+9kLzJf0F2RONX3uMHX9A/ADSV8AHkrWz/pPSQ1mZeWn45odIUnHRKbr22QyRyEXJKEyjsyjyC9Iro0MZVt7IuKYMtX1K2BhROwqx/bMsnzEYXbkfixpEtAI/GVEbAOIiP2Svk6mt/PGShaUnE77pkPD0uAjDjMzK4kvjpuZWUkcHGZmVhIHh5mZlcTBYWZmJXFwmJlZSf4/+EY31j8p6WUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 0.8700000000000001\n"
     ]
    }
   ],
   "source": [
    "alphas = sorted([0.01,0.1,1,10,100] + list(np.arange(2,10,1)) + list(np.arange(0.8,1.2,0.01))) #新增0.8:0.01:1.2与2:10\n",
    "#再做一次岭回归\n",
    "ridge = RidgeCV(alphas=alphas, store_cv_values=True)\n",
    "ridge.fit(X_train, y_train)\n",
    "y_test_pred_ridge = ridge.predict(X_test)\n",
    "y_train_pred_ridge = ridge.predict(X_train)\n",
    "\n",
    "print('岭回归的测试集RMSE：', np.sqrt(mean_squared_error(y_test,y_test_pred_ridge)))\n",
    "print('岭回归的训练集RMSE：', np.sqrt(mean_squared_error(y_train,y_train_pred_ridge)))\n",
    "\n",
    "#可视化\n",
    "mse_mean = np.mean(ridge.cv_values_,axis=0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1))\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "\n",
    "print ('alpha is:', ridge.alpha_)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "从结果上来看，测试集和训练接的RSME没有太大变化，所以超参数取1是比较合适的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Lasso回归的测试集RMSE： 0.1179057436066585\n",
      "Lasso回归的训练集RMSE： 0.11730638647668161\n",
      "alpha is: 0.01\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/tianyu/.local/lib/python3.7/site-packages/sklearn/linear_model/coordinate_descent.py:1100: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n",
      "/home/tianyu/.local/lib/python3.7/site-packages/sklearn/model_selection/_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.\n",
      "  warnings.warn(CV_WARNING, FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "#LassoCV\n",
    "alphas = [0.01,0.1,1,10,100]\n",
    "lasso = LassoCV(alphas=alphas)\n",
    "lasso.fit(X_train, y_train)\n",
    "y_test_pred_lasso = lasso.predict(X_test)\n",
    "y_train_pred_lasso = lasso.predict(X_train)\n",
    "\n",
    "print('Lasso回归的测试集RMSE：', np.sqrt(mean_squared_error(y_test,y_test_pred_lasso)))\n",
    "print('Lasso回归的训练集RMSE：', np.sqrt(mean_squared_error(y_train,y_train_pred_lasso)))\n",
    "print ('alpha is:', lasso.alpha_)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在0.01附近继续寻找有没有更好的超参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Lasso回归的测试集RMSE： 0.09117169147140478\n",
      "Lasso回归的训练集RMSE： 0.08966347805102814\n",
      "alpha is: 0.001\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/tianyu/.local/lib/python3.7/site-packages/sklearn/linear_model/coordinate_descent.py:1100: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n",
      "/home/tianyu/.local/lib/python3.7/site-packages/sklearn/model_selection/_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.\n",
      "  warnings.warn(CV_WARNING, FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "alphas = list(np.arange(0.001,0.01,0.001))\n",
    "lasso = LassoCV(alphas=alphas)\n",
    "lasso.fit(X_train, y_train)\n",
    "y_test_pred_lasso = lasso.predict(X_test)\n",
    "y_train_pred_lasso = lasso.predict(X_train)\n",
    "\n",
    "print('Lasso回归的测试集RMSE：', np.sqrt(mean_squared_error(y_test,y_test_pred_lasso)))\n",
    "print('Lasso回归的训练集RMSE：', np.sqrt(mean_squared_error(y_train,y_train_pred_lasso)))\n",
    "print ('alpha is:', lasso.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Lasso回归的测试集RMSE： 0.0886314843750972\n",
      "Lasso回归的训练集RMSE： 0.08732637717848832\n",
      "alpha is: 0.0001\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/tianyu/.local/lib/python3.7/site-packages/sklearn/linear_model/coordinate_descent.py:1100: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n",
      "/home/tianyu/.local/lib/python3.7/site-packages/sklearn/model_selection/_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.\n",
      "  warnings.warn(CV_WARNING, FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "alphas = list(np.arange(0.0001,0.001,0.0001))\n",
    "lasso = LassoCV(alphas=alphas)\n",
    "lasso.fit(X_train, y_train)\n",
    "y_test_pred_lasso = lasso.predict(X_test)\n",
    "y_train_pred_lasso = lasso.predict(X_train)\n",
    "\n",
    "print('Lasso回归的测试集RMSE：', np.sqrt(mean_squared_error(y_test,y_test_pred_lasso)))\n",
    "print('Lasso回归的训练集RMSE：', np.sqrt(mean_squared_error(y_train,y_train_pred_lasso)))\n",
    "print ('alpha is:', lasso.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "前两项对比的话，RSME有明显变动，继续在0.0001附近寻找最优参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Lasso回归的测试集RMSE： 0.08859305183112058\n",
      "Lasso回归的训练集RMSE： 0.0873110043122541\n",
      "alpha is: 7.000000000000001e-05\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/tianyu/.local/lib/python3.7/site-packages/sklearn/linear_model/coordinate_descent.py:1100: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n",
      "/home/tianyu/.local/lib/python3.7/site-packages/sklearn/model_selection/_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.\n",
      "  warnings.warn(CV_WARNING, FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "alphas = list(np.arange(1e-5,1e-4,1e-5))\n",
    "lasso = LassoCV(alphas=alphas)\n",
    "lasso.fit(X_train, y_train)\n",
    "y_test_pred_lasso = lasso.predict(X_test)\n",
    "y_train_pred_lasso = lasso.predict(X_train)\n",
    "\n",
    "print('Lasso回归的测试集RMSE：', np.sqrt(mean_squared_error(y_test,y_test_pred_lasso)))\n",
    "print('Lasso回归的训练集RMSE：', np.sqrt(mean_squared_error(y_train,y_train_pred_lasso)))\n",
    "print ('alpha is:', lasso.alpha_)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "比较这两次结果，虽然RSME有变化，但是变化不大，可以考虑将7e-05作为最优超参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>lr_coef</th>\n",
       "      <th>ridge_coef</th>\n",
       "      <th>lasso_coef</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>season_4</td>\n",
       "      <td>[17753941056714.215]</td>\n",
       "      <td>[0.08206751002919266]</td>\n",
       "      <td>0.064990</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>season_2</td>\n",
       "      <td>[17753941056714.117]</td>\n",
       "      <td>[0.017928461594205858]</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>season_1</td>\n",
       "      <td>[17753941056714.01]</td>\n",
       "      <td>[-0.0989333326575658]</td>\n",
       "      <td>-0.117243</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>season_3</td>\n",
       "      <td>[17753941056713.94]</td>\n",
       "      <td>[-0.001062638965831697]</td>\n",
       "      <td>-0.017829</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>weekday_5</td>\n",
       "      <td>[1546131767322.4543]</td>\n",
       "      <td>[-0.0026801448160412578]</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>weekday_2</td>\n",
       "      <td>[1546131767322.4536]</td>\n",
       "      <td>[-0.0038512682362576156]</td>\n",
       "      <td>-0.000216</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>weekday_1</td>\n",
       "      <td>[1546131767322.4417]</td>\n",
       "      <td>[-0.01945723420173221]</td>\n",
       "      <td>-0.015981</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>weekday_3</td>\n",
       "      <td>[1546131767322.4248]</td>\n",
       "      <td>[-0.001169489828902831]</td>\n",
       "      <td>0.001899</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>weekday_4</td>\n",
       "      <td>[1546131767322.3486]</td>\n",
       "      <td>[0.003144416699318142]</td>\n",
       "      <td>0.005295</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>[539898589440.91785]</td>\n",
       "      <td>[0.09120313952745043]</td>\n",
       "      <td>0.047272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>[539898589440.81525]</td>\n",
       "      <td>[0.03986619802340499]</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>[539898589440.63074]</td>\n",
       "      <td>[-0.13106933755085626]</td>\n",
       "      <td>-0.170517</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>atemp</td>\n",
       "      <td>[1.1823931709214592]</td>\n",
       "      <td>[0.22387962294464858]</td>\n",
       "      <td>0.426665</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>yr</td>\n",
       "      <td>[0.2303694012230226]</td>\n",
       "      <td>[0.23062679958211252]</td>\n",
       "      <td>0.230393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>hum</td>\n",
       "      <td>[0.09654384423996952]</td>\n",
       "      <td>[-0.13909672459519395]</td>\n",
       "      <td>-0.161942</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>windspeed</td>\n",
       "      <td>[-0.06482515345174182]</td>\n",
       "      <td>[-0.14742378720115012]</td>\n",
       "      <td>-0.150319</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>temp</td>\n",
       "      <td>[-0.30173257039032264]</td>\n",
       "      <td>[0.16313720048316355]</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>weekday_6</td>\n",
       "      <td>[-2860080362880.5786]</td>\n",
       "      <td>[0.03863841985266264]</td>\n",
       "      <td>0.024069</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>weekday_0</td>\n",
       "      <td>[-2860080362880.6045]</td>\n",
       "      <td>[-0.014624699469047486]</td>\n",
       "      <td>-0.028122</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>workingday</td>\n",
       "      <td>[-4406212130203.008]</td>\n",
       "      <td>[0.018176539740555553]</td>\n",
       "      <td>0.000289</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>holiday</td>\n",
       "      <td>[-4406212130203.195]</td>\n",
       "      <td>[-0.04219026012417057]</td>\n",
       "      <td>-0.059040</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>mnth_9</td>\n",
       "      <td>[-7608089839098.107]</td>\n",
       "      <td>[0.08363075213331653]</td>\n",
       "      <td>0.081826</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>mnth_1</td>\n",
       "      <td>[-7608089839098.172]</td>\n",
       "      <td>[-0.04121534463712978]</td>\n",
       "      <td>-0.032181</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>mnth_12</td>\n",
       "      <td>[-7608089839098.186]</td>\n",
       "      <td>[-0.05353020722969716]</td>\n",
       "      <td>-0.048525</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>mnth_7</td>\n",
       "      <td>[-7608089839098.238]</td>\n",
       "      <td>[-0.025002651245906955]</td>\n",
       "      <td>-0.033891</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>mnth_2</td>\n",
       "      <td>[-7608089839098.255]</td>\n",
       "      <td>[-0.02473172773646977]</td>\n",
       "      <td>-0.017795</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>mnth_4</td>\n",
       "      <td>[-7608089839098.263]</td>\n",
       "      <td>[-0.002117812417566936]</td>\n",
       "      <td>-0.001478</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>mnth_3</td>\n",
       "      <td>[-7608089839098.286]</td>\n",
       "      <td>[0.019117240446109574]</td>\n",
       "      <td>0.022190</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>mnth_8</td>\n",
       "      <td>[-7608089839098.327]</td>\n",
       "      <td>[0.02314172729665054]</td>\n",
       "      <td>0.016839</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>mnth_5</td>\n",
       "      <td>[-7608089839098.337]</td>\n",
       "      <td>[0.03177918149882708]</td>\n",
       "      <td>0.029062</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>mnth_10</td>\n",
       "      <td>[-7608089839098.4]</td>\n",
       "      <td>[0.01846724343775752]</td>\n",
       "      <td>0.016935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>mnth_6</td>\n",
       "      <td>[-7608089839098.422]</td>\n",
       "      <td>[0.023293316792907484]</td>\n",
       "      <td>0.016783</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>mnth_11</td>\n",
       "      <td>[-7608089839098.425]</td>\n",
       "      <td>[-0.05283171833879846]</td>\n",
       "      <td>-0.050519</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         columns                 lr_coef                ridge_coef  lasso_coef\n",
       "10      season_4    [17753941056714.215]     [0.08206751002919266]    0.064990\n",
       "8       season_2    [17753941056714.117]    [0.017928461594205858]    0.000000\n",
       "7       season_1     [17753941056714.01]     [-0.0989333326575658]   -0.117243\n",
       "9       season_3     [17753941056713.94]   [-0.001062638965831697]   -0.017829\n",
       "31     weekday_5    [1546131767322.4543]  [-0.0026801448160412578]   -0.000000\n",
       "28     weekday_2    [1546131767322.4536]  [-0.0038512682362576156]   -0.000216\n",
       "27     weekday_1    [1546131767322.4417]    [-0.01945723420173221]   -0.015981\n",
       "29     weekday_3    [1546131767322.4248]   [-0.001169489828902831]    0.001899\n",
       "30     weekday_4    [1546131767322.3486]    [0.003144416699318142]    0.005295\n",
       "23  weathersit_1    [539898589440.91785]     [0.09120313952745043]    0.047272\n",
       "24  weathersit_2    [539898589440.81525]     [0.03986619802340499]    0.000000\n",
       "25  weathersit_3    [539898589440.63074]    [-0.13106933755085626]   -0.170517\n",
       "4          atemp    [1.1823931709214592]     [0.22387962294464858]    0.426665\n",
       "0             yr    [0.2303694012230226]     [0.23062679958211252]    0.230393\n",
       "5            hum   [0.09654384423996952]    [-0.13909672459519395]   -0.161942\n",
       "6      windspeed  [-0.06482515345174182]    [-0.14742378720115012]   -0.150319\n",
       "3           temp  [-0.30173257039032264]     [0.16313720048316355]    0.000000\n",
       "32     weekday_6   [-2860080362880.5786]     [0.03863841985266264]    0.024069\n",
       "26     weekday_0   [-2860080362880.6045]   [-0.014624699469047486]   -0.028122\n",
       "2     workingday    [-4406212130203.008]    [0.018176539740555553]    0.000289\n",
       "1        holiday    [-4406212130203.195]    [-0.04219026012417057]   -0.059040\n",
       "19        mnth_9    [-7608089839098.107]     [0.08363075213331653]    0.081826\n",
       "11        mnth_1    [-7608089839098.172]    [-0.04121534463712978]   -0.032181\n",
       "22       mnth_12    [-7608089839098.186]    [-0.05353020722969716]   -0.048525\n",
       "17        mnth_7    [-7608089839098.238]   [-0.025002651245906955]   -0.033891\n",
       "12        mnth_2    [-7608089839098.255]    [-0.02473172773646977]   -0.017795\n",
       "14        mnth_4    [-7608089839098.263]   [-0.002117812417566936]   -0.001478\n",
       "13        mnth_3    [-7608089839098.286]    [0.019117240446109574]    0.022190\n",
       "18        mnth_8    [-7608089839098.327]     [0.02314172729665054]    0.016839\n",
       "15        mnth_5    [-7608089839098.337]     [0.03177918149882708]    0.029062\n",
       "20       mnth_10      [-7608089839098.4]     [0.01846724343775752]    0.016935\n",
       "16        mnth_6    [-7608089839098.422]    [0.023293316792907484]    0.016783\n",
       "21       mnth_11    [-7608089839098.425]    [-0.05283171833879846]   -0.050519"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fs = pd.DataFrame({\"columns\":list(X.columns), \"lr_coef\":list((lr.coef_.T)), \"ridge_coef\":list((ridge.coef_.T)), \"lasso_coef\":list((lasso.coef_.T))})\n",
    "fs.sort_values(by=['lr_coef'],ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "比较各个模型的特征系数，最小二乘波动性最大，非常不稳定,原因是特征间存在较强相关性\n",
    "Lasso和Ridge两者相比的话，Ridge效果最好\n",
    "总的来说Lasso和岭回归推荐使用，最小二乘对特征间存在较强相关性的时候波动性比较大"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
